package com.zebra.remoting.protocol;


import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Command code for rpc remoting command.
 *  TMS 使用 0 不用    1: Disruptor  2: 线程池
 * @author SK
 */
public enum PoolType {

    NOT( 0),  //0 不用
    DISRUPTOR(  1),  // 1: Disruptor
    EXECUTOR(  2)  //2: 线程池
     ;
    private int value;

    PoolType(int value) {
        this.value = value;
    }


    private final static Map<Integer, PoolType> stateMap
            = Arrays.stream(PoolType.values()).collect(Collectors.toMap(PoolType::value, t -> t));


    public int value() {
        return this.value;
    }

    public static PoolType valueOf(int value) {
       return stateMap.get(value);
    }

}